package org.example.demo3.controller;

import lombok.extern.slf4j.Slf4j;
import org.example.demo3.untils.AliOSSUtils;
import org.example.demo3.vo.result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@RequestMapping("file")
@Slf4j
public class FileController {

    @Autowired
    private AliOSSUtils aliOSSUtils;

    @PostMapping("/upload")
    public result uplaod(MultipartFile image) throws IOException {
        String url = aliOSSUtils.upload(image);
        return result.success(url);
    }


}
